import request from '@/utils/request.js'

export const tagList = (data) => {
    return request({
        url: '/tag/list',
        method: 'get',
        params: data
    })
}

// 新增标签
export const newTag = (data) => {
    return request({
        url: '/tag',
        method: 'post',
        data: data
    })
}

// 标签详情
export const detailTag = (id) => {
    return request({
        url: '/tag/' + id,
        method: 'get'
    })
}

// 编辑标签
export const editTag = (data) => {
    return request({
        url: '/tag',
        method: 'put',
        data: data
    })
}

// 标签删除
export const tagRowDel = (id) => {
    return request({
        url: `/tag/${id}`,
        method: 'delete'
    })
}

// 标签批量删除
export const tagsDel = (ids) => {
    return request({
        url: `/tag/batchDelete`,
        method: 'delete',
        data: ids
    })
}

// 标签导出
export const tagExport = (data)=> {
    return request({
        url: `/tag/export`,
        method: 'post',
        data: data,
        responseType: 'blob'//处理乱码问题，转化为blob类型
    })
}

// 下标签导入模板
export const tagReload = () => {
    return request({
        url: '/tag/reload',
        method:'post',
        headers:{'Content-Type':'multipart/form-data'},
        responseType: 'blob',
    })
}
